package com.risen.project.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 项目状态枚举
 */
@Getter
public enum ProjectStatusEnum {
    WLX("1", "未立项"),
    YLX_WQD("2", "已立项-未启动"),
    YLX_JSZ("3", "已立项-建设中"),
    YLX_YYS("4", "已立项-已验收"),
    YLX_YZZ("5", "已立项-已终止"),
    YLX_BGJSZ("6", "已立项-变更建设中"),
    ;

    private final String code;
    private final String msg;

    ProjectStatusEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsgByCode(String code) {
        Optional<ProjectStatusEnum> optional = Arrays.stream(values())
                .filter(c -> c.code.equals(code))
                .findFirst();

        return optional.isPresent() ? optional.get().msg : "";
    }
}
